package com.weixing.mall.provider.controller.front;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.annotation.NoNeedAccess;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.provider.model.domain.Banner;
import com.weixing.mall.provider.model.enums.cms.BannerLocEunm;
import com.weixing.mall.provider.model.enums.cms.BannerTypeEunm;
import com.weixing.mall.provider.model.query.BannerQuery;
import com.weixing.mall.provider.model.vo.cms.BannerVo;
import com.weixing.mall.provider.service.IBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName FrontBannerController
 * @Description TODO <br/>
 * @Author gjq
 * @Modified By:
 * @Date 2019/10/30
 * @Version 1.0
 **/
@RestController
@RequestMapping("front/banner")
@Api(value = "前端轮播图api",tags = "前端轮播图")
public class FrontBannerController extends BaseController {


    @Autowired
    private IBannerService bannerService;

    @ApiOperation(value = "加载前端轮播图（轮播图查询状态为1可用,不用传时间参数）")
    @GetMapping("")
    @NoNeedAccess
    public Result list(BannerLocEunm bannerLoc) {
        List<BannerVo> vos = bannerService.selectListByType(bannerLoc, BannerTypeEunm.BANNER);
        return ResultUtil.success(vos);
    }

}
